public class Test {
    public static void main(String[] args) {
        A a = new B();
        System.out.println(a.name);
    }
}

class A {
    public String name = "Person";
}

class B extends A {
    public String name = "Person1";
    private String grade;
}